package com.tanhua.dubbo.api;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.tanhua.domain.db.UserInfo;
import com.tanhua.dubbo.mapper.UserInfoMapper;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.Date;
@Service
public class UserInfoApiImpl implements UserInfoApi {

    @Autowired
    private UserInfoMapper userInfoMapper;
    @Override
    public void save(UserInfo userInfo) {
        userInfoMapper.insert(userInfo);
    }

    @Override
    public void update(UserInfo userInfo) {

        userInfoMapper.updateById(userInfo);
    }


    /**
     * 用户基本资料
     * @param userId 用户id
     * @return
     */
    @Override
    public UserInfo findById(Long userId) {
        return userInfoMapper.selectById(userId);
    }

    /**
     * 用户数据局翻页
     * @param page
     * @param pagesize
     * @return
     */
    @Override
    public IPage<UserInfo> finList(int page, int pagesize) {
        return userInfoMapper.selectPage(new Page<>(page, pagesize), null);
    }


}
